// 隧道窑
<template>
  <div class="container card">
    <el-tabs v-model="kilnActiveName" type="card" @tab-click="handleClick">
      <el-tab-pane label="测点信息表" name="stationInfo">
        <stationInfo v-if="stationInfo" />
      </el-tab-pane>
      <el-tab-pane label="进车信息表" name="enterCar">
        <enterCar v-if="enterCar" />
      </el-tab-pane>
      <el-tab-pane label="出车信息表" name="outCar">
        <outCar v-if="outCar" />
      </el-tab-pane>
      <el-tab-pane label="交接班表" name="handover">
        <handover v-if="handover" />
      </el-tab-pane>
      <el-tab-pane label="产品信息表" name="productInfo">
        <productInfo v-if="productInfo" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import stationInfo from './stationInfo'
import enterCar from './enterCar'
import outCar from './outCar'
import handover from './handover'
import productInfo from './productInfo'
export default {
  name: '',
  components: {
    stationInfo,
    enterCar,
    outCar,
    handover,
    productInfo
  },
  props: {},
  data () {
    return {
      kilnActiveName: 'stationInfo',
      stationInfo: true,
      enterCar: false,
      outCar: false,
      handover: false,
      productInfo: false
    }
  },
  computed: {},
  watch: {},
  created () {
    if (sessionStorage.getItem('kilnActiveName')) {
      // console.log('session', sessionStorage.getItem('kilnActiveName'))
      if (sessionStorage.getItem('kilnActiveName') === 'naturalGas' || sessionStorage.getItem('kilnActiveName') === 'other' || sessionStorage.getItem('kilnActiveName') === 'parkingLot') {
        this.kilnActiveName = 'stationInfo'
        this.stationInfo = true
        this.enterCar = false
        this.outCar = false
        this.handover = false
        this.productInfo = false
      } else {
        this.kilnActiveName = sessionStorage.getItem('kilnActiveName')
        switch (sessionStorage.getItem('kilnActiveName')) {
          case 'stationInfo':
            this.stationInfo = true
            this.enterCar = false
            this.outCar = false
            this.handover = false
            this.productInfo = false
            break
          case 'enterCar':
            this.stationInfo = false
            this.enterCar = true
            this.outCar = false
            this.handover = false
            this.productInfo = false
            break
          case 'outCar':
            this.stationInfo = false
            this.enterCar = false
            this.outCar = true
            this.handover = false
            this.productInfo = false
            break
          case 'handover':
            this.stationInfo = false
            this.enterCar = false
            this.outCar = false
            this.handover = true
            this.productInfo = false
            break
          case 'productInfo':
            this.stationInfo = false
            this.enterCar = false
            this.outCar = false
            this.handover = false
            this.productInfo = true
            break
          default:
            console.log('出错了')
            break
        }
      }
    }
  },
  beforeDestroy () {
    sessionStorage.setItem('kilnActiveName', 'stationInfo')
  },
  mounted () {},
  methods: {
    handleClick (tab, event) {
      switch (tab.index) {
        case '0':
          this.stationInfo = true
          this.enterCar = false
          this.outCar = false
          this.handover = false
          this.productInfo = false
          break
        case '1':
          this.stationInfo = false
          this.enterCar = true
          this.outCar = false
          this.handover = false
          this.productInfo = false
          break
        case '2':
          this.stationInfo = false
          this.enterCar = false
          this.outCar = true
          this.handover = false
          this.productInfo = false
          break
        case '3':
          this.stationInfo = false
          this.enterCar = false
          this.outCar = false
          this.handover = true
          this.productInfo = false
          break
        case '4':
          this.stationInfo = false
          this.enterCar = false
          this.outCar = false
          this.handover = false
          this.productInfo = true
          break
        default:
          console.log('出错了')
          break
      }
    }
  }
}
</script>

<style scoped lang="">

</style>
